/* Copyright 2017, 2018, 2019, 2020 Gabriel Czernikier
 *
 * This file is part of Côtehaus.
 * Côtehaus is free software: you can redistribute it and/or modify
 * it under the terms of one of the following:
 * 1. The same dual license as that of Côtehaus itself, of which individual licenses are
 * the MIT License and the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 2. The MIT License.
 * 3. The GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * Côtehaus is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * MIT License and the GNU General Public License for more details.
 * You should have received a copy of the MIT License and the GNU General Public License
 * along with Côtehaus.  If not, see <https://opensource.org/licenses/MIT> and <http://www.gnu.org/licenses/>.
 */
#ifndef __CH_CONTEXT_H
#define __CH_CONTEXT_H
#include "composer.h"
#include "type_id.h"
#include "types.h"
struct context_st {
	struct class_def_st enclosing_class;
	struct search_entry_st innest_search_entry;
	struct list_head search_context_item_head;   //struct search_context_item_st : search_context_item's in scope from this context.
	// dyn_* as for "dynamic programming", shorten circuit to speed up a repeated search, populated with searches on search_entry
	struct dyn_field_st *dyn_fields;  // struct dyn_field_st = struct { lgw_seq_t key(member name), struct field_id_st field_id }
	struct dyn_method_st *dyn_methods;  // struct dyn_method_st = struct { lgw_seq_t key(member name), struct method_id_st method_id }
	struct dyn_variable_st *dyn_variables;  // struct dyn_variable_st = struct { lgw_seq_t key(variable name), struct variable_id_st variable_id }
	struct dyn_type_st *dyn_types;  // struct dyn_type_st = struct { lgw_seq_t key(type name), struct type_id_st type_id }
	struct list_head context_head_list;   //struct context_st : contexts pushed onto a context stack
};

struct context_st *context_fork_push();
void *context_pop_free();
struct context_st *context_peek();
void context_free_all();
#endif
